/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ecouteurs;

import controleur.Controleur;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.lang.Thread;
import javax.swing.JButton;

/**
 *
 * @author Harakan
 */

public class EcouteurStart implements MouseListener{
 private JButton B;
    
    
    public EcouteurStart(JButton B) {
        this.B = B;
        //new thresad...;
    }

    public void mouseClicked(MouseEvent e) {
        String nomBouton = B.getText();
        if (nomBouton.equals("Start")){
        Controleur.setContinueSimu(true);
        new Thread(Controleur.getInstance()).start();;
        B.setText("Stop");      
        }
        if (nomBouton.equals("Stop")){
        Controleur.setContinueSimu(false);
        B.setText("Start");      
        }
        if (nomBouton.equals("Quitter")){
            System.exit(0);          
        }       
        
    }

    public void mousePressed(MouseEvent e) {
      //   throw new UnsupportedOperationException("Not supported yet.");
      
    }

    public void mouseReleased(MouseEvent e) {
     //   throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseEntered(MouseEvent e) {
    //    throw new UnsupportedOperationException("Not supported yet.");
    }

    public void mouseExited(MouseEvent e) {
    //    throw new UnsupportedOperationException("Not supported yet.");
    }

}
